package org.jeecg.modules.bj.controller;

import java.util.*;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;

import org.jeecg.common.api.vo.Result;
import org.jeecg.common.system.query.QueryGenerator;
import org.jeecg.modules.activiti.service.Impl.ActBusinessServiceImpl;
import org.jeecg.modules.bj.dto.BjBdBean;
import org.jeecg.modules.bj.dto.BjQuitBean;
import org.jeecg.modules.bj.dto.ToMyApplyInput;
import org.jeecg.modules.bj.entity.BjGwbd;
import org.jeecg.modules.bj.entity.BjIdcardfk;
import org.jeecg.modules.bj.entity.BjQuit;
import org.jeecg.modules.bj.mapper.BjQuitMapper;
import org.jeecg.modules.bj.service.IBjIdcardfkService;

import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import lombok.extern.slf4j.Slf4j;

import org.jeecg.common.system.base.controller.JeecgController;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;
import org.springframework.web.multipart.MultipartFile;
import org.springframework.web.servlet.ModelAndView;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.jeecg.common.aspect.annotation.AutoLog;

 /**
 * @Description: bj_idcardfk
 * @Author: jeecg-boot
 * @Date:   2021-10-22
 * @Version: V1.0
 */
@Api(tags="bj_idcardfk")
@RestController
@RequestMapping("/bj/bjIdcardfk")
@Slf4j
public class BjIdcardfkController extends JeecgController<BjIdcardfk, IBjIdcardfkService> {
	@Autowired
	private IBjIdcardfkService bjIdcardfkService;
	 @Autowired
	 ActBusinessServiceImpl actBusinessService;
	
	/**
	 * 分页列表查询
	 *
	 * @param bjIdcardfk
	 * @param pageNo
	 * @param pageSize
	 * @param req
	 * @return
	 */
	@AutoLog(value = "bj_idcardfk-分页列表查询")
	@ApiOperation(value="bj_idcardfk-分页列表查询", notes="bj_idcardfk-分页列表查询")
	@GetMapping(value = "/list")
	public Result<?> queryPageList(BjIdcardfk bjIdcardfk,
								   @RequestParam(name="pageNo", defaultValue="1") Integer pageNo,
								   @RequestParam(name="pageSize", defaultValue="10") Integer pageSize,
								   HttpServletRequest req) {
		QueryWrapper<BjIdcardfk> queryWrapper = QueryGenerator.initQueryWrapper(bjIdcardfk, req.getParameterMap());
		Page<BjIdcardfk> page = new Page<BjIdcardfk>(pageNo, pageSize);
		IPage<BjIdcardfk> pageList = bjIdcardfkService.page(page, queryWrapper);
		return Result.ok(pageList);
	}

	 /**
	  *   添加入职信息
	  *
	  */
	 @PostMapping(value = "/addRuzhi")
	 public Result<?> addRuzhi(@RequestBody List<Map> dataList) {
		 List<Map<String,String>> list=bjIdcardfkService.addRuzhi(dataList);
		 return Result.ok(list);
	 }

	 /**
	  *   添加离职信息
	  *
	  */
	 @PostMapping(value = "/addLizhi")
	 public Result<?> addLizhi(@RequestBody List<BjQuitBean> bjQuitBean) {
		 List<Map<String,String>> list=bjIdcardfkService.addLizhi(bjQuitBean);
		 return Result.ok(list);
	 }

	 /**
	  *   添加变动信息
	  *
	  */
	 @PostMapping(value = "/addBiandong")
	 public Result<?> addBiandong(@RequestBody BjBdBean bjBdBean) {
		 String id=bjIdcardfkService.addBiandong(bjBdBean);
		 return Result.ok(id);
	 }

	 /**
	  *   获取离职人员列表
	  *
	  */
	 @PostMapping(value = "/getLizhiPersonList")
	 public Result<?> getLizhiPersonList(@RequestParam  String procInstId){
		 List<Map<String,String>> list=bjIdcardfkService.getLizhiPersonList(procInstId);
		 return Result.ok(list);
	 }

	 //
     @ApiOperation(value="bj_idcardfk-分页列表查询", notes="bj_idcardfk-分页列表查询")
     @GetMapping(value = "/getLizhiBjQuitPage")
     public Result<?> getLizhiBjQuitPage(@RequestParam(name="pageNo", defaultValue="1") Integer pageNo,
                                         @RequestParam(name="pageSize", defaultValue="10") Integer pageSize){
         return bjIdcardfkService.getLizhiBjQuitPage(pageNo,pageSize);
     }


	 @PostMapping(value = "/saveActBussinessDataBeforApprove")
	 public Result<?> saveActBussinessDataBeforApprove(@RequestBody  Map map){
		 String ids=map.get("ids").toString();
		 String type=map.get("type").toString();
		 return Result.ok(bjIdcardfkService.saveActBusinessBeforeApprove(ids,type));
	 }

	 @PostMapping(value = "/deleteActBussinessById")
	 public Result<?> deleteActBussinessById(@RequestBody  Map map){
		 String actBussinessid=map.get("actBussinessid").toString();
		 return Result.ok(bjIdcardfkService.deleteActBusinessById(actBussinessid));
	 }

}
